package com.ruoyi.hospital.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.MaterielMapper;
import com.ruoyi.hospital.domain.Materiel;
import com.ruoyi.hospital.service.IMaterielService;

/**
 * 物资Service业务层处理
 * 
 * @author qichi
 * @date 2023-07-10
 */
@Service
public class MaterielServiceImpl implements IMaterielService 
{
    @Autowired
    private MaterielMapper materielMapper;

    /**
     * 查询物资
     * 
     * @param id 物资主键
     * @return 物资
     */
    @Override
    public Materiel selectMaterielById(Long id)
    {
        return materielMapper.selectMaterielById(id);
    }

    /**
     * 查询物资列表
     * 
     * @param materiel 物资
     * @return 物资
     */
    @Override
    public List<Materiel> selectMaterielList(Materiel materiel)
    {
        return materielMapper.selectMaterielList(materiel);
    }

    /**
     * 新增物资
     * 
     * @param materiel 物资
     * @return 结果
     */
    @Override
    public int insertMateriel(Materiel materiel)
    {
        materiel.setCreateTime(DateUtils.getNowDate());
        return materielMapper.insertMateriel(materiel);
    }

    /**
     * 修改物资
     * 
     * @param materiel 物资
     * @return 结果
     */
    @Override
    public int updateMateriel(Materiel materiel)
    {
        materiel.setUpdateTime(DateUtils.getNowDate());
        return materielMapper.updateMateriel(materiel);
    }

    /**
     * 批量删除物资
     * 
     * @param ids 需要删除的物资主键
     * @return 结果
     */
    @Override
    public int deleteMaterielByIds(Long[] ids)
    {
        return materielMapper.deleteMaterielByIds(ids);
    }

    /**
     * 删除物资信息
     * 
     * @param id 物资主键
     * @return 结果
     */
    @Override
    public int deleteMaterielById(Long id)
    {
        return materielMapper.deleteMaterielById(id);
    }
}
